<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>
        <p:dialog id="EmailEditDlg" widgetVar="EmailEditDialog" modal="true" resizable="false"  appendTo="@(body)" header="#{bundle.EditEmailTitle}" closeOnEscape="true">

            <h:form id="EmailEditForm">

                <h:panelGroup id="display">
                    <p:panelGrid  columns="2" rendered="#{emailController.selected != null}">

                        <h:outputLabel value="#{bundle.EditEmailLabel_id}" for="id" />
                        <h:panelGroup>
                            <h:outputText id="id" value="#{emailController.selected.id}" />
                            <p:tooltip for="id" value="#{emailController.getComponentMessages('id', bundle.EditEmailHelpText_id)}"/>
                        </h:panelGroup>


                        <p:outputLabel value="#{bundle.EditEmailLabel_email}" for="email" />
                        <h:panelGroup>
                            <p:inputText id="email" value="#{emailController.selected.email}" title="#{bundle.EditEmailTitle_email}" required="true" requiredMessage="#{bundle.EditEmailRequiredMessage_email}" size="255" maxlength="255"/>
                            <p:tooltip for="email" value="#{emailController.getComponentMessages('email', bundle.EditEmailHelpText_email)}"/>
                        </h:panelGroup>


                        <p:outputLabel value="#{bundle.EditEmailLabel_pessoa}" for="pessoa" />
                        <h:panelGroup>
                            <p:selectOneMenu id="pessoa" value="#{emailController.selected.pessoa}" required="true" requiredMessage="#{bundle.EditEmailRequiredMessage_pessoa}" converter="pessoaConverter">
                                <f:selectItem itemLabel="#{bundle.SelectOneMessage}"/>
                                <f:selectItems value="#{pessoaController.items}"
                                               var="pessoaItem"
                                               itemValue="#{pessoaItem}"
                                               itemLabel="#{pessoaItem.id.toString()}"
                                               />

                            </p:selectOneMenu>
                            <p:tooltip for="pessoa" value="#{emailController.getComponentMessages('pessoa', bundle.EditEmailHelpText_pessoa)}"/>
                        </h:panelGroup>
                    </p:panelGrid>
                    <p:commandButton actionListener="#{emailController.save}" value="#{bundle.Save}" update="display,:EmailListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,EmailEditDialog);">
                        <p:confirm header="#{bundle.ConfirmationHeader}" message="#{bundle.ConfirmEditMessage}" icon="ui-icon-alert"/>
                    </p:commandButton>
                    <p:commandButton value="#{bundle.Cancel}" onclick="EmailEditDialog.hide()"/>
                </h:panelGroup>

            </h:form>

        </p:dialog>

    </ui:composition>

</html>
